Phantasy Star (Classic Series) Hacking  Guide
Please contact the author, Chris Hatala (GhaleonUnlimited on RHDN or the PS Cave Discord) about additions or comments (hatalawriting@gmail.com).

Table of Contents:

Section 1: Intro
1.1 - Intro
1.2 - Existing Fanhacks
1.3 - Software You Need
1.4 - Game Disassemblies
1.5 - PS Disassembly File Locations

Section 2: Editing
2.1 - Best Practices
2.2 - Proper Nouns
2.3 - Script

Section 3: Other Resources and Stuff to Try

Section 1: Intro

1.1 - Intro

Note: This guide is written for PSIV romhacking, but should apply to each PS game with minimal difference

Despite your love of the Phantasy Star games as they are, are there one or two things that you wish could be better, with 30+ years in hindsight since their original releases?

Well, you can change them, even if you have zero programming skills! You just need a little free time and and a willingness to experiment.

Note that there are a few fanhacks out there already, so check these to see if your problems are already solved. (And you can also contact the patch creator via RomHacking.net to see if it’s a change they’re willing to incorporate.)

Whether you simply want to change one character’s name to match your preferred vision of the story, or you want to rewrite the entire game as a Star Wars fanfiction, the only limit is your patience.

And your romhack should be playable via emulator or on a real console, either via an Everdrive or by removing the ROM from a real cart and putting yours on. That’s a whole ‘no

1.2 - Existing Romhacks and Advice

Romhacking.net is the main location to find romhacks for games from any generation. Anyone can upload stuff, and it’s free for users and creators. If you register, you can contact patch authors, as well.

PSIV.GamesDoneLegit.com has a link to each classic PS game’s RHDN page, as well as some recommended patches and PS fan resources. 

You’’ll also find a podcast there, “Found in Fanslation”, by this author, which might provide hacking insight for you through interviews with people way better at it than me.

The author of this document created the “Phantasy Star Generation 4 - PSIV Relocalization”, and I’m not a programmer (in fact, I hate doing it). 

Everything in here is really basic and stuff I was able to figure out on my own.

More advanced stuff could be added to this document at a later time, but this’ll get you started.

The PS Cave Discord server is a great place to talk to other PS fans, and a few PS fanhackers regularly post there too, if you need help

1.3 - Hardware/Software You Need

A: A Windows PC
B: Any Master System / Genesis/Mega Drive Emulator (I use Gens because I’m old)
C. Notepad++ is the recommended HTML editing program. (You’re free to use your favorite HTML editor.)

Helpful shortcuts
CTRL+SHIFT+F: 
Find in files (meaning, search for one word or phrase in a whole folder/directory instead of just one file. Useful to change a character’s name or proper noun in all files).

NOTE: Pay attention to the options “Match Whole Case” and “Match Whole Word”.
For one requester, I hurriedly changed “Alys” to “Lyla” in PSIV without looking at the options, and any file that contained “Alys” or “alys” was changed to “Lyla”
So they found some strange typos like “anLylais” instead of “analysis”!

CTRL+S: Save (current file only)
CTLR+Z: Undo action
CTRL+Y: Redo previously undid action

1.4 - Game Disassemblies

Having a game’s disassembly is like having a LEGO set, new in the box with all the instructions. You can see what the final product looks like, but someone’s written the instructions already that tell you where everything goes, and since it’s brand-new, you’re sure you’ve got all the pieces.

And of course you can put the pieces together however you want, and see what you get.

It might be better than the original, or if it might not work at all.

Without a disassembly, editing most games 16-bit and later is like looking at a car and trying to figure out how it works with no manual or engineering skills.

With a disassembly, you can have no programming skills and make significant changes to the game, especially text-related. If you are (or you get help from) a programmer, pretty much everything in the game -- music, graphics, etc. -- can be changed.

1.5 - PS Disassembly File Locations

PS Disassembly (Original)
PS SMSPower 2.0 Retranslation Disassembly

PSII Disassembly

PSIII Disassembly

PSIV Disassembly
PS Generation:4 (PSIV Relocalization) Disassembly

Section 2: Editing

2.1 - How to Edit and Make Your Rom
A: Run “build.bat” and it’ll compile the game with your changes. It spits a fresh “ps4built.bin” (a runnable ROM) each time you do. It also makes “ps4built.prev.bin”, which was the previous ver you compiled.

B: If any problems prevented it from making a good ROM, the command window will remain open, tell you in general what the errors were, and it spits out a ps4.log (or something -- it’ll tell you what it’s called) that gives you the file name where the problem was, and a description

For instance, if a quotation mark is missing at the end of a line of dialog, batch.bin will not compile and you’ll have to open the ps4.log to see what line the error is on.

Often times, one error creates a LOT of errors, so always start from the top of the error list.

Many errors though are not syntax but semantic. Semantic errors are the stuff you just have to play the game to find. (For instance, a character speaking another character’s dialog. It’s all coded correctly for the machine, but it’s not what you wanted).

IMPORTANT: The game only has so much room to display text. If you go past the character limit on a line, it’s going to be messed up in game. This just requires trial and error.

C: Once you have a ps4built.bin, just open it with a Genesis emulator. As a test, try editing something at the beginning of the game (e.g. the intro story text, or Alys’s opening lines in PSIV).

2.2 - Proper Nouns

A: Open and edit ps4.asm (witn Notepad++) in the root directory
B: Before each section in the code, there are notes written by the disassembler to tell you very simply what this section controls (e.g. Monster names, Names of Places, etc.)
C: You don’t want to change the name of stuff in the code, just the visible text that the player will see. Anything the player will see is surrounded by quotes.

Ex: I want to change the skill “Flaeli” to “Flare”.
Search for “Flaeli” (WITH THE QUOTES) in ps4.asm
You’ll find “Flaeli” in both the enemy skills and the party’s skills
Just change the text to whatever you want (“Flare” in this case).

2.3 - Script

Each game has a separate folder called “script” that contains most of the dialog in the game. 
Try to leave the code in game alone until you get a feel for the character limits and the codes that control which character says the line, etc.

In PSIV, the dialog is separated into “dialogXX.asm” files.

For instance, in PSIV dialog files, the end of line cannot go farther than Col:47

A: Character Limits -  See Pic Below
This line shows up properly in the game. If this line had ONE more character (48 or more) , it would screw up the conservation in-game.
Note that this is a “symantic” error, so it will compile just fine. You’d have to play the game and get to this part to see if it’s messed up or not.
.

B: Codes to Know

B1: Hexadecimal For Dummies

If you’re editing the script, once you know what to look for, it’s easy to add text and set which character is talking. If you’re going to add any lines, you should at least know what hexadecimal is.

Instead of counting to 1 to 9, then 10 to 19, like we usually do, hex counts higher using letters before it moves up to 10. For just basic PS hacking, it’s just helpful to know up to like 20 in hex.

Just use a hex calculator if you need to, esp for more complex stuff like editing how much items cost or how much XP and meseta you get from enemies.

So basically you count 1 to 15 using letters after “9”
So in hex, the number 10 is actually the number 16
Hexadecimal            Decimal

1 		=	  1
2 		= 	  2
Etc.
8 		= 	  8
9 		= 	  9
A 		= 	 10
B 		=	 11
C 		=	 12
D 		=	 13
E 		=	 14
F 		=	 15
10 		=	 16
11		=	 17
Etc.
19  		=	  25
1A		=	  26
Etc.
1F		=	  31
20		=	  32

You should know:
-How to set who’s talking (normal NPCs have no special code): 
$F4
$0X (“X” meaning variable, not “X” the letter)

-How to divide up lines of dialog to display right ($FC and $FD)
-How to end the dialog line ($FF)

(See next page)
B2: Character codes
This is the beginning of dialog 35.asm

To set which character is speaking, look at the code about the dialog line. 
$F4
$0X (“X” meaning variable, not “X” the letter)

So 

$F4
$01
 is Alys/Lyra

$F4
$02
Is Chaz/Rudy … and so on.

B3: Conversation Codes
Only a few things you should know. Refer to pic above once again.

-How to divide up lines of dialog and end a conversation  ($FC and $FD, and $FF )
In PSII, III and IV the player sees dialog on 2 lines, then it replaces it with new dialog on the screen. So in the code, we have to do the same.
Take the conversation above. I’ll break down below what the codes mean with my notes in yellow

; $1 In each dialog file, each conversation is numbered
	dc.b	$F4 $F4 means a character portrait will pop up. Ties to line below it
	dc.b	$01 Controls what character portrait shows. $01 is Alys/Lyra
	dc.b	"You...are you Forren?"
	dc.b	$FC Makes the line below appear in the same dialog box as the line above
	dc.b	"Wow, you're huge!"
	dc.b	$FD End of dialog box. Makes this character stop speaking. 
	dc.b	$F4
	dc.b	$08 Wren’s char portrait pops up because of $08 under the $F4 above it
	dc.b	"Ah, compared to you, correct."
	dc.b	$FC
	dc.b	$F2, $00 Whenever you see anything weird like these 2 lines in dialog, it’s a story 
	dc.w	$0077 transition. DON’T TOUCH IT!
	dc.b	"My name is FORREN, but as I am"
	dc.b	$FC
	dc.b	"likely the last -REN unit left"
	dc.b	$FD Like before, means end of dialog box
	dc.b	"in Algol with decision-making"
	dc.b	$FC
	dc.b	"processing, simply call me WREN."
	dc.b	$FD Like before, means this character stops talking 

And so on
dc.b	$FF Marks the end of the conversation

Section 3: Other Resources and Stuff to Try

Once you more used to looking at the code and understand hex, you can pretty much change anything in the game.

I don’t know how to any of that, but there are a few PS hackers who might know. 
Post in the PS Cave Discord (invite in Section 1) for help!